home *** CD-ROM | disk | FTP | other *** search
/ Sky at Night 2007 May / SAN CD 5-2007 CD-ROM 24.iso / pc / Software / ISSsimulator_Win / install.exe / install.dxr / 00002_Installer.ls < prev    next >
Encoding:
Text File  |  2007-03-09  |  3.1 KB  |  105 lines

  1. property pAppFolder, pDesktop, pInstallPath, pPathSep, pSourceFolder, pSourceFileList, pCopiedFileList
  2.  
  3. on new me
  4.   if the platform contains "Mac" then
  5.     baMsgBox("This software is for PC only", "Install ISS Simulator V3.0", "OK", "stop", 1)
  6.     halt()
  7.   else
  8.     me.pPathSep = "\"
  9.     me.pAppFolder = baSysFolder("program files")
  10.     me.pSourceFolder = the moviePath & "ISSsimulator_V3.0\"
  11.   end if
  12.   me.pDesktop = baSysFolder("desktop")
  13.   me.pInstallPath = me.pAppFolder & "ISSsimulator_V3.0" & pPathSep
  14.   me.pSourceFileList = baFileList(me.pSourceFolder, "*.*")
  15.   me.pCopiedFileList = []
  16.   return me
  17. end
  18.  
  19. on confirmInstallation me
  20.   confirmed = 0
  21.   dialogResult = confirmInstallationDialog()
  22.   if dialogResult[2] = "Continue" then
  23.     confirmed = 1
  24.   end if
  25.   return confirmed
  26. end
  27.  
  28. on getInstallPath me
  29.   dialogResult = getInstallPathDialog(VOID, VOID, VOID, VOID, VOID, [#installPathField: me.pInstallPath], VOID, VOID, VOID)
  30.   case dialogResult[2] of
  31.     "Browse":
  32.       newPath = baGetFolder(me.pInstallPath, "Select installation folder", 2, EMPTY, -2, -2)
  33.       if newPath <> EMPTY then
  34.         if confirmValidPath(me, newPath) then
  35.           me.pInstallPath = newPath
  36.         end if
  37.       end if
  38.       getInstallPath(me)
  39.     "Continue":
  40.       me.pInstallPath = dialogResult[3][#installPathField]
  41.       if confirmValidPath(me, me.pInstallPath) then
  42.         if (me.pInstallPath = me.pAppFolder) or (me.pInstallPath = me.pDesktop) then
  43.           me.pInstallPath = me.pInstallPath & "ISS Simulator V3.0"
  44.         end if
  45.         if not baFolderExists(me.pInstallPath) then
  46.           baCreateFolder(me.pInstallPath)
  47.         end if
  48.       else
  49.         baMsgBox("You entered an invalid installation path. Please try again", "Install ISS Simulator V3.0", "OK", "exclamation", 1)
  50.         getInstallPath(me)
  51.       end if
  52.     "Exit":
  53.       halt()
  54.   end case
  55. end
  56.  
  57. on confirmValidPath me, aPath
  58.   lastDelimiter = the itemDelimiter
  59.   pathIsValid = 1
  60.   the itemDelimiter = me.pPathSep
  61.   if baDiskList().getOne(aPath.item[1] & me.pPathSep) = 0 then
  62.     pathIsValid = 0
  63.   end if
  64.   the itemDelimiter = lastDelimiter
  65.   return pathIsValid
  66. end
  67.  
  68. on installFiles me
  69.   cursor(4)
  70.   installResult = 1
  71.   if me.pSourceFileList.count > 0 then
  72.     repeat with i = 1 to me.pSourceFileList.count
  73.       thisSource = me.pSourceFolder & me.pSourceFileList[i]
  74.       thisDest = me.pInstallPath & me.pSourceFileList[i]
  75.       copyResult = baCopyFile(thisSource, thisDest, "always")
  76.       if copyResult = 0 then
  77.         if me.pCopiedFileList.getOne(me.pSourceFileList[i]) = 0 then
  78.           me.pCopiedFileList.add(me.pSourceFileList[i])
  79.         end if
  80.         next repeat
  81.       end if
  82.       installResult = 0
  83.     end repeat
  84.   else
  85.     installResult = 0
  86.   end if
  87.   cursor(-1)
  88.   return installResult
  89. end
  90.  
  91. on undoInstallation me
  92.   cursor(4)
  93.   if me.pCopiedFileList.count > 0 then
  94.     repeat with i = 1 to me.pCopiedFileList.count
  95.       baDeleteFile(me.pInstallPath & me.pCopiedFileList[i])
  96.     end repeat
  97.     me.pCopiedFileList = []
  98.   end if
  99.   cursor(-1)
  100. end
  101.  
  102. on makeShortcut me
  103.   baMakeShortcut(me.pInstallPath & "iss_main.htm", me.pDesktop, "ISS Simulator V3.0")
  104. end
  105.